package alicuu.util;

import java.util.Random;

/**
 * Created by IntelliJ IDEA.
 * User: danny
 * Date: 17/03/02/
 * Time: 16:20
 */
public class Tools {
    private static Random random = new Random();

    public static String getRandomString(int length) {
        char[] arr = new char[length];

        for (int i = 0; i < length; i++) {
            arr[i] = (char) (random.nextInt(26) + 97);
            if (i % 5 == 0)
                arr[i] = Character.toUpperCase(arr[i]);
        }
        return new String(arr);
    }

    public static int getRandom(int ceiling) {
        return random.nextInt(ceiling);
    }

    public static String getRandomIp() {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < 4; i++)
            sb.append(getRandom(256)).append('.');
        sb.deleteCharAt(sb.length() - 1);
        return sb.toString();
    }
}
